package com.kehutong.common.enums;

import org.coraframework.util.HashID;

public enum Gender implements HashID {

    NOMORE("0", "未知"),
    MALE("1", "男"),
    FEMALE("2", "女"),

    ;
    private final String id;
    private final String desc;

    private Gender(String id, String desc) {
        this.id = id;
        this.desc = desc;
    }

    public static Gender getGender(String desc) {
        Gender[] genders = values();
        for (Gender gender : genders) {
            if (gender.getDesc().equals(desc)) {
                return gender;
            }
        }
        return null;
    }

    public static Gender getGenderById(String id) {
        Gender[] genders = values();
        for (Gender gender : genders) {
            if (gender.getId().equals(id)) {
                return gender;
            }
        }
        return null;
    }
    @Override
    public String getId() {
        return id;
    }

    @Override
    public String getDesc() {
        return desc;
    }
}
